import 'package:cbec_app/components/base/base_image.dart';
import 'package:cbec_app/components/base/base_interactive.dart';
import 'package:cbec_app/components/base/base_page.dart';
import 'package:cbec_app/components/common/common_style.dart';
import 'package:cbec_app/pages/login/binding/login_binding.dart';
import 'package:cbec_app/pages/login/controller/login_ctr.dart';
import 'package:cbec_app/routes/routes.dart';
import 'package:cbec_app/utils/Tools.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

///输入两次密码的注册二级页面
class Resigter extends GetView<LoginController> {
  Resigter({super.key});

  @override
  Widget build(BuildContext context) {
    return GetBuilder<LoginController>(builder:(controller) {
      return WillPopScope(
        child: BasePage(
          bodyColor: Colors.white,
          children: [
            //登录logo
            Container(
              margin: EdgeInsets.only(top: 90.w),
              alignment: Alignment.center,
              child: BaseImage(url: "login_logo.png", width: 140, height: 140),
            ),
            Container(
              margin: EdgeInsets.fromLTRB(18.w, 20.w, 18.w, 0.w),
              // color: Colors.red,
              child: Column(
                children: [
                  //密码输入框
                  Container(
                      height: 44.h,
                      // margin: EdgeInsets.only(top: 20.w),
                      padding: EdgeInsets.only(left: 16.w, right: 16.w),
                      decoration: border_radis(Tools.fromHex("#F3F5F7"),
                          radiusValue: 50),
                      child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              SizedBox(
                                width: 200.w,
                                child: TextFormField(
                                  onChanged: controller.onInputPassword,
                                  obscureText: controller.hidePassword,
                                  decoration: descript("请输入密码"),
                                ),
                              ),
                              BaseInteractive(
                                  onClick: () => {controller.showHidePassword()},
                                  childWidget: BaseImage(
                                      url: controller.passWordHideShowPic,
                                      width: 16,
                                      height: 16))
                            ],
                          )),
                  //确认密码输入框
                  Container(
                      height: 44.h,
                      margin: EdgeInsets.only(top: 20.w),
                      padding: EdgeInsets.only(left: 16.w, right: 16.w),
                      decoration: border_radis(Tools.fromHex("#F3F5F7"),
                          radiusValue: 50),
                      child:Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              SizedBox(
                                width: 200.w,
                                child: TextFormField(
                                  onChanged: controller.onInputConfirmPassword,
                                  obscureText: controller.hidePassword,
                                  decoration: descript("请再次输入密码"),
                                ),
                              ),
                              BaseInteractive(
                                  onClick: () => {controller.showHidePassword()},
                                  childWidget: BaseImage(
                                      url: controller.passWordHideShowPic,
                                      width: 16,
                                      height: 16))
                            ],
                          )),
                  //提示语
                  Container(
                    alignment: Alignment.centerLeft,
                    margin: EdgeInsets.only(top: 10.w, left: 16.w),
                    child: Text(
                      "*需要与第一次密码输入一致",
                      style: TextStyle(
                          fontSize: 10,
                          fontWeight: FontWeight.w400,
                          color: Tools.fromHex("#F83F2D")),
                    ),
                  ),
                  buttons()
                ],
              ),
            )
          ],
        ),
        onWillPop: () async {
          return false;
        });
    },);
    
  }

  /**
       * 按钮
       */
  Widget buttons() => Container(
        margin: EdgeInsets.only(top: 56.w),
        width: double.infinity,
        color: Colors.white,
        // padding: EdgeInsets.fromLTRB(18.w, 18.w, 18.w, 18.w),
        child: ElevatedButton(
            style: ButtonStyle(
              backgroundColor:
                  MaterialStateProperty.all(controller.buttonColor),
            ),
            onPressed: () {
              //这里注册成功后返回到登录页面，并且是账号密码登录
              // Get.toNamed(Routes.login),
              // loginCtr.checkStatus(3)
              controller.completeRegister();
            },
            child: Text(
              "确定",
              //loginCtr.btnTxt.value,
              style: const TextStyle(
                  fontSize: 14.0,
                  fontWeight: FontWeight.w500,
                  color: Colors.white),
            )),
      );

  LoginBinding loginBinding = LoginBinding();
}
